package com.ymttest.utils.compare;

import java.io.File;
import java.io.IOException;

import com.ymttest.utils.YMTDateUtil;

public class LogPathConf {
	private  String folderPath;
	private  String infoPath;
	private  String diffPath;
	private  String errorPath;
	
	
	public LogPathConf(){
	
		/*String defolderPath = System.getProperty("user.dir") + File.separator + 
						YMTDateUtil.getFormatTime(YMTDateUtil.getDate(), "yyyy_MM_dd_HH_mm_ss_SSS");*/
		this(true);
	}
	
	public LogPathConf(boolean ignoreInfoPath){
		this(System.getProperty("user.dir") + File.separator + "Results" + File.separator +
				YMTDateUtil.getFormatTime(YMTDateUtil.getDate(), "yyyy_MM_dd_HH_mm_ss_SSS"),ignoreInfoPath);
	}
	
	
	
	public LogPathConf(String folderPath){
		this(folderPath,true);
	}
	
	public LogPathConf(String folderPath,boolean ignoreInfoPath){
		init(folderPath,ignoreInfoPath);
	}
	
	private void init(String folderPath,boolean ignoreInfoPath){
		
		this.folderPath = folderPath;
		if (ignoreInfoPath){
			this.infoPath = "";
		}else{
			this.infoPath = folderPath +File.separator+"log.txt";
		}
		this.diffPath = folderPath +File.separator+"diff.txt";
		this.errorPath = folderPath +File.separator+"error.txt";
		
		
		File file = new File(folderPath);
		if (!file.exists()){file.mkdirs();}
		
		
		try {
			if (this.infoPath!=""){
				new File(infoPath).createNewFile();
			}
			new File(diffPath).createNewFile();
			new File(errorPath).createNewFile();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
	

	public String getFolderPath() {
		return folderPath;
	}

	public void setFolderPath(String folderPath) {
		this.folderPath = folderPath;
	}

	public String getInfoPath() {
		return infoPath;
	}

	public void setInfoPath(String infoPath) {
		this.infoPath = infoPath;
	}

	public String getDiffPath() {
		return diffPath;
	}

	public void setDiffPath(String diffPath) {
		this.diffPath = diffPath;
	}

	public String getErrorPath() {
		return errorPath;
	}

	public void setErrorPath(String errorPath) {
		this.errorPath = errorPath;
	}
	
	
	
}
